<include file='Index/header'/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/lib/select2/dist/css/select2.min.css">
<style>
    .input1 {
        width: 50px;

    }

    .input2 {

        width: 500px;

    }

    .input3 {

        width: 160px;

    }
</style>

<script type="text/javascript" src="__PUBLIC__/lib/select2/dist/js/select2.min.js"></script>
<script language="javascript" type="text/javascript" src="__PUBLIC__/My97DatePicker/WdatePicker.js"></script>
<include file='Index/left'/>

<div class="content">

    <div class="header">

        <h1 class="page-title">数据导入</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="{:U('Index/Index')}">首页</a> <span class="divider">/</span></li>
        <li class="active">培训数据导入</li>
    </ul>
    <div class="well well-sm" style="height:20px;">培训信息表导入
        <span style="margin-left: 50%">
            <a href="{:U('Dr/TempletDownload')}" style="line-height: 1.6em; margin-top: 5px">
                模板下载
            </a>
        </span>
    </div>

    <div class="container-fluid">
        <div class="row-fluid">
            <div>
                <form action="__CONTROLLER__/Upload/fs/px" method="post" enctype="multipart/form-data">
                    <input name="photo" type="file" value="" style="width:400px"/>
                    <input type="submit" value="上传" name=""/>
                </form>

            </div>
            <hr/>
            <div id="form">
                <!--判断$data 是否是空-->
                <if condition="$data neq ''">

                    <form id="form1" name="form1" method="post" action="">
                        <table width="1000" border="1" style="text-align:center">
                            <tr>
                                <td colspan="10"><strong><h2>红旗渠干部学院培训信息表</h2></strong></td>
                            </tr>
                            <tr>
                                <td colspan="10">班次编号：
                                    <!--<input type="text" name="bcbh" id="bcbh" value="{$data.bcbh}" maxlength="9">-->
                                <!--<td colspan="8"><label for="zbdw"></label>-->
                                    <input name="bcbh" type="text" id="bcbh" size="100" class='input2'
                                           value="{$data.bcbh}"/></td>

                                    <span class="alert alert-danger" style="width:100px; display:none" id="error"></span>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" nowrap style="padding: 0.5%">接班老师：
                                    <select id='jteacher' name="jteacher" class="select select2_input" size="1"
                                            placeholder="请选择"  style="width: 100px">
                                        <option value="{$data.jteacher}">{$data.jteacher}</value>
                                            <volist name="teacher" id="vo">
                                        <option value="{$vo.tname}">{$vo.tname}</value>
                                            </volist>
                                    </select>
                                </td>

                                <td colspan="3">带班老师：
                                    <select id='dteacher' class="select select2_input" name="dteacher" size="1"
                                            placeholder="请选择" style="width: 100px">
                                        <option value="{$data.dteacher}">{$data.dteacher}</value>
                                            <volist name="teacher" id="vo">
                                        <option value="{$vo.tname}">{$vo.tname}</value>
                                            </volist>
                                    </select>
                                </td>

                                <td colspan="3">班次类别：
                                    <select id='classlb' class="select select2_input" name="classlb" size="1"
                                            placeholder="请选择" style="width: 100px">
                                        <option value="{$data.classlb}">{$data.classlb}</value>
                                            <volist name="classlb" id="vo">
                                        <option value="{$vo.dict_name}">{$vo.dict_name}</value>
                                            </volist>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td width="18" rowspan="16">基本信息</td>
                                <td width="104">主办单位</td>
                                <td colspan="8"><label for="zbdw"></label>
                                    <input name="zbdw" type="text" id="zbdw" size="100" class='input2'
                                           value="{$data.zbdw}"/></td>
                            </tr>
                            <tr>
                                <td>班次名称</td>
                                <td colspan="8"><label for="bcmc"></label>
                                    <input name="bcmc" type="text" id="bcmc" size="100" class='input2'
                                           value="{$data.bcmc}"/></td>
                            </tr>
                            <tr>
                                <td>学员构成</td>
                                <td colspan="8"><input name="xygc" type="text" id="xygc" size="100" class='input2'
                                                       value="{$data.xygc}"/></td>
                            </tr>
                            <tr>
                                <td rowspan="2">人数</td>
                                <td width="73">学员人数</td>
                                <td width="56"><input name="xyrs" type="text" id="xyrs" size="5" class='input1'
                                                      value="{$data.xyrs}"/></td>
                                <td width="168">带队人数</td>
                                <td width="127"><input name="ddrs" type="text" id="ddrs" size="5" class='input1'
                                                       value="{$data.ddrs}"/></td>
                                <td width="62">司机人数</td>
                                <td width="44"><input name="sjrs" type="text" id="sjrs" size="5" class='input1'
                                                      value="{$data.sjrs}"/></td>
                                <td width="122">总计人数</td>
                                <td width="197"><input name="zjrs" type="text" id="zjrs" size="5" class='input1'
                                                       value="{$data.zjrs}"/></td>
                            </tr>
                            <tr>
                                <td>省部级人数</td>
                                <td>
                                    <input name="sbjrs" type="text" id="sbjrs" size="5" class='input1'
                                           value="{$data.sbjrs}"/>
                                </td>
                                <td>局厅级人数</td>
                                <td><input name="jtjrs" type="text" id="jtjrs" size="5" class='input1'
                                           value="{$data.jtjrs}"/></td>
                                <td>县处级人数</td>
                                <td><input name="xcjrs" type="text" id="xcjrs" size="5" class='input1'
                                           value="{$data.xcjrs}"/></td>
                                <td>科级以下人数</td>
                                <td><input name="kjyxrs" type="text" id="kjyxrs" size="5" class='input1'
                                           value="{$data.kjyxrs}"/></td>
                            </tr>
                            <tr>
                                <td rowspan="2">预约培训人数</td>
                                <td colspan="2">抵达时间</td>
                                <td colspan="2"><input type="text" name="ddsj" id="ddsj" class='input3'
                                                       value="{$data.ddsj}"/></td>
                                <td colspan="2">离开时间</td>
                                <td colspan="2"><input type="text" name="lksj" id="lksj" class='input3'
                                                       value="{$data.lksj}"/></td>
                            </tr>
                            <tr>
                                <td colspan="4">是否同意根据学院培训整体安排适当调整培训时间</td>
                                <td>同意</td>
                                <td><input name="bcmc13" type="text" id="bcmc13" size="5" class='input1' value=""/></td>
                                <td>不同意</td>
                                <td><input name="bcmc14" type="text" id="bcmc14" size="5" class='input1' value=""/></td>
                            </tr>
                            <tr>
                                <td>报道方式</td>
                                <td>学院接站</td>
                                <td><input name="bcmc15" type="text" id="bcmc15" size="5" class='input1' value=""/></td>
                                <td>自带车辆报道</td>
                                <td><input name="bcmc16" type="text" id="bcmc16" size="5" class='input1' value=""/></td>
                                <td>自行报到</td>
                                <td><input name="bcmc17" type="text" id="bcmc17" size="5" class='input1' value=""/></td>
                                <td>其他</td>
                                <td><input type="text" name="bcmc18" id="bcmc18" class='input1' value=""/></td>
                            </tr>
                            <tr>
                                <td rowspan="4">接送站信息（预计）</td>
                                <td colspan="2">交通方案</td>
                                <td>接站时间</td>
                                <td colspan="2">航班/班次</td>
                                <td colspan="2">返程时间</td>
                                <td>航班/班次</td>
                            </tr>
                            <tr>
                                <td colspan="2">安阳高铁站</td>
                                <td><input type="text" name="gtsj" id="gtsj" class='input3' value="{$data.gtsj}"/></td>
                                <td colspan="2"><input type="text" name="gtbc" id="gtbc" class='input3'
                                                       value="{$data.gtbc}"/></td>
                                <td colspan="2"><input type="text" name="gtfcsj" id="bcmc21" class='input3'
                                                       value="{$data.gtfcsj}"/></td>
                                <td><input type="text" name="gtfcbc" id="gtfcbc" class='input3' value="{$data.gtfcbc}"/>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">新郑机场</td>
                                <td><input type="text" name="jcsj" id="jcsj" class='input3' value="{$data.jcsj}"/></td>
                                <td colspan="2"><input type="text" name="jcbc" id="jcbc" class='input3'
                                                       value="{$data.jcbc}"/></td>
                                <td colspan="2"><input type="text" name="jcfcsj" id="jcfcsj" class='input3'
                                                       value="{$data.jcfcsj}"/></td>
                                <td><input type="text" name="jcfcbc" id="jcfcbc" class='input3' value="{$data.jcfcbc}"/>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">其他</td>
                                <td><input type="text" name="qtsj" id="qtsj" class='input3' value="{$data.qtsj}"/></td>
                                <td colspan="2"><input type="text" name="qtbc" id="qtbc" class='input3'
                                                       value="{$data.qtbc}"/></td>
                                <td colspan="2"><input type="text" name="qtfcsj" id="qtfcsj" class='input3'
                                                       value="{$data.qtfcsj}"/></td>
                                <td><input type="text" name="qtfcbc" id="qtfcbc" class='input3' value="{$data.qtfcbc}"/>
                                </td>
                            </tr>
                            <tr>
                                <td>住宿需求</td>
                                <td>单间数</td>
                                <td><input name="djs" type="text" id="djs" size="8" class='input1' value="{$data.djs}"/>
                                </td>
                                <td>标间数</td>
                                <td><input name="bjs" type="text" id="bjs" size="8" class='input1' value="{$data.bjs}"/>
                                </td>
                                <td>餐饮禁忌</td>
                                <td colspan="3"><input type="text" name="cyjj" id="cyjj" class='input1'
                                                       value="{$data.cyjj}"/></td>
                            </tr>
                            <tr>
                                <td colspan="2">联系人姓名</td>
                                <td colspan="2"><input type="text" name="lxrxm" id="lxrxm" class='input3'
                                                       value="{$data.lxrxm}"/></td>
                                <td colspan="2">邮箱</td>
                                <td colspan="3"><input type="text" name="yx" id="yx" class='input3' value="{$data.yx}"/>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">联系人职务</td>
                                <td colspan="7"><input name="lxrzw" type="text" id="lxrzw" size="100" class='input2'
                                                       value="{$data.lxrzw}"/></td>
                            </tr>
                            <tr>
                                <td colspan="2">联系人手机</td>
                                <td colspan="2"><input type="text" name="lxrsj" id="lxrsj" class='input3'
                                                       value="{$data.lxrsj}"/></td>
                                <td colspan="2">固定电话</td>
                                <td colspan="3"><input type="text" name="gddh" id="gddh" class='input3'
                                                       value="{$data.gddh}"/></td>
                            </tr>
                            <tr>
                                <td>培训方需求</td>
                                <td colspan="9"><label for="pxfxq"></label>
                                    <textarea name="pxfxq" id="pxfxq" cols="100" rows="5"
                                              class='input2'>{$data.pxfxq}</textarea></td>
                            </tr>
                            <tr>
                                <td>确认信息</td>
                                <td colspan="9"><textarea name="qrxx" id="qrxx" cols="100" rows="5" class='input2'>{$data.qrxx}</textarea>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="10">
                                    <button type="button" class="btn-primary btn-lg btn-block" onclick="tj()">提交信息
                                    </button>
                                </td>
                            </tr>
                        </table>
                    </form>
                </if>
            </div>
            <script type="text/javascript">
                $(".select2_input").select2({
                    allowClear: true,
                    placeholder:"请选择",
                    //tags: "true",
                    maximumInputLength: 20,
                });

            </script>
            <script type="text/javascript">

                function tj() {
                    var bcbh = $('#bcbh').val();
                    if (bcbh === '') {
                        alert('班次编号不能为空');
                        $('#error').show();
                        $('#error').text('班次编号不能为空');
                        exit();
                    }
                    $.ajax({
                        type: "POST",
                        url: "__CONTROLLER__/add",
                        cache: false,
                        data: $('#form1').serialize(),
                        success: function (data) {
                            switch (data) {
                                case '0':
                                    if (confirm("班次信息已上传成功,是否继续上传学员信息")) {
                                        location.href = "__CONTROLLER__/Xueyuanadmin/bcbh/" + bcbh + "";
                                    } else {
                                        location.href = "__CONTROLLER__/PeixunList";
                                    }
                                    break;
                                case '1':
                                    alert('添加失败，请检查表单项');

                                    break;
                                case '2':
                                    alert('班次编号已存在');
                                    $('#error').show();
                                    $('#error').text('班次编号已存在');
                                    break;
                                default:
                                    alert(data);
                            }
                        }
                    })
                }
            </script>

            <include file='Index/footer'/>
